package com.module.home.ui.scoringFactors.provider

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.common.app.data.bean.home.ScoringItemBean
import com.common.app.widget.AnimatedRoundProgressBar
import com.common.base.utils.ViewUtils
import com.common.base.utils.ViewUtils.getColor
import com.module.home.R

/**
 *
 * 作者：sosou
 *
 * 版本：1.0
 *
 * 创建日期：2025/08/27
 *
 * 描述：
 *
 * 修订历史：
 *
 */
class ScoringFactorsAnnulusItemAdapter(type: String = "") :
    BaseQuickAdapter<ScoringItemBean, BaseViewHolder>(R.layout.home_scoring_factors_annulus_list_item_layout) {

    val mType = type

    override fun convert(holder: BaseViewHolder, item: ScoringItemBean) {
        holder.getView<AnimatedRoundProgressBar>(R.id.rpdView).let {
            when (mType) {// "improvable","excellent","good"
                "excellent" -> {
                    it.cricleColor = getColor(R.color.c_c4ecec)
                    it.cricleProgressColor = getColor(R.color.c_12b2b2)
                }
//                "good" -> {
//                    it.setCricleColor(R.color.c_dae5fc)
//                    it.setCricleProgressColor(R.color.c_6a98f4)
//                }
                "improvable" -> {
                    it.cricleColor = getColor(R.color.c_ffe7cf)
                    it.cricleProgressColor = getColor(R.color.c_ff9f40)
                }
                "severity" -> {
                    it.cricleColor = getColor(R.color.c_fcd7de)
                    it.cricleProgressColor = getColor(R.color.c_f3607b)
                }
                else -> {
                    it.cricleColor = getColor(R.color.c_dae5fc)
                    it.cricleProgressColor = getColor(R.color.c_6a98f4)
                }
            }
            it.setProgressWithAnimation(item.score)
        }

        holder.setText(R.id.tvTitle,item.name)
        holder.setText(R.id.tvNote,item.description)
    }

    override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        super.onItemViewHolderCreated(viewHolder, viewType)
    }

}